# -*- coding: utf-8 -*-
'''
@author: Hugo
@file: converters.py
@time: 2021/11/18 17:36
'''
from django.urls import converters

# 用户名转换器
class UsernameConverter:
    regex = '[a-zA-Z0-9]{5,20}'

    def to_python(self,value):
        return value
# 手机号转换器
class MobileConverter():
    regex = '1[3-9]\d{9}'

    def to_python(self,value):
        return int(value)

# 匹配图形验证码的 UUID
class UUIDConverter():
    regex = '[\w-]+'

    def to_python(self,value):
        return value